

#include <input_manager.h>
#include <pthread.h>
#include <stdio.h>
#include <semaphore.h>
#include <string.h>
#include "ui.h"



static struct Button button_led ={

	.name ="led",
	.status= 0,
	.tRegion={

		.leftup_x = 100,
		.leftup_y = 100,
		.width    = 300,
		.heigh    = 300,		
	},


};

void delay_xxxx(void)
{

int i,j;

for(i=0 ;i<0x00ffff;i++)
{
	for(j=0 ;j<0x00ffff;j++)
	{
	
	
	
	
	
	
	
	}







}


}


int main (int argc, char ** argv)
{
	inputEvent getinput;

	DispBuff_p getdisbuff;



	if(argc != 2)
	 {
		printf("Usaged:\n");
	 	printf("%s <fontfile> \n", argv[0]);

	 }

		 
	
	
	Inputinit();
	initdeviceInput();



	 
	DisplayInit();
	selectdefaulterDisplay("fb");
	
	initdefaulterDisplay();
	
	getdisbuff = get_initdisbuffer();
	
	FontlibInit();
	selectdefaulterFontlib("freetype");
	initdefaulterFontlib(argv[1]);
	
	 InitButton(button_led.name, &button_led, &button_led.tRegion, NULL, NULL);



	 lcd_clear();

	 button_led.DrawButton(&button_led, getdisbuff);

	while(1)
	{
		GetALLInputEvent(&getinput);
		
		if((getinput.x > button_led.tRegion.leftup_x)  &&  (getinput.x < (button_led.tRegion.leftup_x + button_led.tRegion.width)))
		{

			if((getinput.y > button_led.tRegion.leftup_y)  &&  (getinput.y < (button_led.tRegion.leftup_y +  button_led.tRegion.heigh)))
			{

				if(getinput.pressure != 0)
				{

					button_led.Checked(&button_led, getdisbuff,&getinput); 
					delay_xxxx();
					
				}



			}


		}
		
		printf("X:%x \n",getinput.x);
		printf("Y:%x \n",getinput.y);
		printf("pressure:%x \n",getinput.pressure);

	}
	
}


























































